/**
 * 获取真实方法的映射
 * @param scope 上下文变量
 * @param events 事件json
 * @returns 绑定scope的方法的map
 */
export default function getEvents(scope: any, events: { [key: string]: string }): API.IEventsMap {
  const newEvents: API.IEventsMap = {};
  for (const key in events) {
    if (Object.prototype.hasOwnProperty.call(events, key)) {
      newEvents[key] = scope[events[key]].bind(scope);
    }
  }
  return newEvents;
}